import time
from selenium import webdriver
from selenium.webdriver.common.by import By

ap = ['账号', '密码']
# 实例化对象
driver = webdriver.Chrome()
driver.get('https://mail.163.com')
time.sleep(3)
# 定位元素
frame = driver.find_element(By.CSS_SELECTOR, 'iframe[id*=x-URS-iframe]')
driver.switch_to.frame(frame)
a = driver.find_element(By.CSS_SELECTOR, 'div[id="account-box"]>div[class="u-input box"]>input')
p = driver.find_element(By.CSS_SELECTOR, 'input[placeholder="输入密码"][name="password"]')


# 输入密码
def putin(a1, p1):
    a.send_keys(a1)
    p.send_keys(p1)


putin(*ap)

# 登录
driver.find_element(By.LINK_TEXT, '登  录').click()
time.sleep(5)
